package com.qianfeng.wuyang.himalaya.fragment;


import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.qianfeng.wuyang.himalaya.R;
import com.qianfeng.wuyang.himalaya.adapter.FragmentRbDownLoadAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * A simple {@link Fragment} subclass.
 */
public class RbDownLoadFragment extends Fragment {
    private ViewPager viewPager;
    private TabLayout tabLayout;
    private List<String> list;


    public RbDownLoadFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view= inflater.inflate(R.layout.fragment_rb_down_load, container, false);
        intViewFragment(view);
        return view;
    }

    private void intViewFragment(View view) {
        viewPager= (ViewPager) view.findViewById(R.id.rb_downloadFragmentViewPager);
        tabLayout= (TabLayout) view.findViewById(R.id.rb_downloadFragmentTabLayout);
        list= new ArrayList<>();

        for (int i = 0; i < 3; i++) {
          list.add("数据"+i);
          }
        viewPager.setAdapter(new FragmentRbDownLoadAdapter(getChildFragmentManager(),list));
        tabLayout.setupWithViewPager(viewPager);

    }

}
